home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************/
- /* */
- /* Source - RoundWDEF.c */
- /* Author - Alexander S. Colwell, Copyright (C) 1988 */
- /* */
- /* Purpose - This is WDEF definition for "Debugger" DA's demo. */
- /* */
- /* Routine - Main : Main entry point module. */
- /* DoDrawMsg : Do draw window frame message. */
- /* DoHitMsg : Do mouse-hit window message. */
- /* DoCalcMsg : Do calculate window message. */
- /* DoGrowMsg : Do grow window message. */
- /* */
- /* Revisions - None. */
- /* */
- /********************************************************************/
-
- #include <WindowMgr.h> /* Window Manager defs */
- #include <SetUpA4.h> /* Setup Register A4 */
- #include "Debugger.h" /* Debugger defs */
-
- /* Compilation directives */
- #define DEBUG /* Enable debugging stuff */
-
- /* 'WDEF' entry point */
- pascal long main(varCode,theWindow,message,param)
-
- short varCode; /* Variation code */
- WindowPtr theWindow; /* Window pointer */
- short message; /* Message command */
- long param; /* Parameter control */
-
- {
-
- long status = 0L; /* Working status indicator */
-
- RememberA0(); /* Remember A0 global pointer */
-
- SetUpA4(); /* Setup register A4 */
-
- #ifdef DEBUG /* Check if want debugging */
-
- /* Output debugging info */
- DbgPrint(DbgGetRefHdl(),"WDEF: message - %d\n",message);
-
- #endif
-
- switch(message) { /* Process message handler */
-
- case wNew: /* Opening window */
- break;
-
- case wDispose: /* Closing window */
- break;
-
- case wDraw: /* Draw window frame */
- DoDrawMsg(theWindow,param); break;
-
- case wHit: /* Check mouse down hits */
- status = DoHitMsg(theWindow,param); break;
-
- case wCalcRgns: /* Calculate window's regions */
- DoCalcMsg(theWindow); break;
-
- case wGrow: /* Grow window */
- DoGrowMsg(theWindow,param); break;
-
- case wDrawGIcon: /* Draw window's Grow Icon */
- break;
-
- }
-
- RestoreA4(); /* Restore register A4 */
-
- return(status); /* Return status indicator */
-
- }
-
- DoDrawMsg(theWindow,param)
-
- WindowPtr theWindow; /* Window pointer */
- long param; /* Message parameter */
-
- {
-
- Rect wRect; /* Working window rect area */
- long wPat[2]; /* Working white pattern */
- long bPat[2]; /* Working black pattern */
-
- if (!param) { /* Check if want to frame it */
-
- wPat[0] = wPat[1] = 0L; /* Init patterns */
- bPat[0] = bPat[1] = 0xFFFFFFFFL;
-
- /* Set window rect area */
- wRect = (*((WindowPeek)(theWindow))->strucRgn)->rgnBBox;
-
- PenNormal(); /* Reset pen characteristics */
-
- FrameOval(&wRect); /* Frame outer-most part */
-
- InsetRect(&wRect,1,1); /* Frame between part */
- PenPat(wPat);
- FrameOval(&wRect);
-
- InsetRect(&wRect,1,1); /* Frame middle part */
- PenSize(3,3);
- PenPat(bPat);
- FrameOval(&wRect);
-
- InsetRect(&wRect,3,3); /* Frame between part */
- PenSize(1,1);
- PenPat(wPat);
- FrameOval(&wRect);
-
- InsetRect(&wRect,1,1); /* Frame inter-most part */
- PenSize(1,1);
- PenPat(bPat);
- FrameOval(&wRect);
-
- InsetRect(&wRect,1,1); /* Frame between part of content*/
- PenPat(wPat);
- FrameOval(&wRect);
- PenPat(bPat);
-
- }
-
- }
-
- DoHitMsg(theWindow,pt)
-
- WindowPtr theWindow; /* Window pointer */
- Point pt; /* Mouse-down point */
-
- {
-
- register short status; /* Working status flag */
-
- /* Check if point inside region */
- if (PtInRgn(pt,((WindowPeek)(theWindow))->contRgn))
- status = wInContent; /* Yup, inside contents */
- else /* Nope, outside contents */
- status = wNoHit; /* Set no hit indicator */
-
- return(status); /* Return hit status indicator */
-
- }
-
- DoCalcMsg(theWindow)
-
- WindowPtr theWindow; /* Window pointer */
-
- {
-
- Rect wRect; /* Working window rect area */
-
- wRect = theWindow->portRect;/* Set window rect area */
-
- /* Normalize window rect area */
- OffsetRect(&wRect,-theWindow->portBits.bounds.left,
- -theWindow->portBits.bounds.top);
-
- /* Setup content's region area */
- SetEmptyRgn(((WindowPeek)(theWindow))->contRgn);
- OpenRgn();
- FrameOval(&wRect);
- CloseRgn(((WindowPeek)(theWindow))->contRgn);
-
- /* Setup content's region area */
- SetEmptyRgn(((WindowPeek)(theWindow))->strucRgn);
- OpenRgn();
- InsetRect(&wRect,-8,-8);
- FrameOval(&wRect);
- CloseRgn(((WindowPeek)(theWindow))->strucRgn);
-
- }
-
- DoGrowMsg(theWindow,theRect)
-
- WindowPtr theWindow; /* Window pointer */
- Rect *theRect; /* Rect area to grow */
-
- {
-
- FrameOval(theRect); /* Draw the frame area */
-
- }
-
-